package com.example.androidstart.opengl;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.example.androidstart.R;
import com.example.androidstart.opengl.render.FGLView;
import com.example.androidstart.opengl.shape.ColorfulTriangle;
import com.example.androidstart.opengl.shape.Cube;
import com.example.androidstart.opengl.shape.IsoscelesTriangle;
import com.example.androidstart.opengl.shape.Oval;
import com.example.androidstart.opengl.shape.Square;
import com.example.androidstart.opengl.shape.Texture2DRender;
import com.example.androidstart.opengl.shape.Triangle;

public class DrawShapeActivity extends AppCompatActivity {

    FGLView mFGLView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extraBundle = getIntent().getExtras();
        String drawType = extraBundle.getString("drawtype");
        setContentView(R.layout.activity_opengles);
        mFGLView = findViewById(R.id.draw_gl_content_container);
        if ("triangle".equals(drawType)) {
            mFGLView.setShape(Triangle.class);
        } else if ("image".equals(drawType)) {
            mFGLView.setShape(Texture2DRender.class);
        } else if ("IsoscelesTriangle".equals(drawType)) {
            mFGLView.setShape(IsoscelesTriangle.class);
        } else if ("colorfulTriangle".equals(drawType)) {
            mFGLView.setShape(ColorfulTriangle.class);
        } else if ("square".equals(drawType)) {
            mFGLView.setShape(Square.class);
        } else if("circle".equals(drawType)){
            mFGLView.setShape(Oval.class);
        } else if("Cube".equals(drawType)){
            mFGLView.setShape(Cube.class);
        }
    }
}